Release 10.1A: OpenEdge Development:
Progress 4GL Reference
Parameter definition syntax
This syntax defines one or more run-time parameters of a user-defined function, or a method within a class (including a constructor method).
Note: To define run-time parameters in a Progress subprocedure, Windows dynamic link library (DLL) routine, UNIX shared library routine, or ActiveX control event procedure, see the DEFINE PARAMETER statement reference entry in this book.(parameter[,parameter] ... )Use the following syntax to define each
parameter, which can be scalar, array, class, interface, temporary table object, ProDataSet object, or buffer:
INPUT | OUTPUT | INPUT-OUTPUTThe parameter mode. An input parameter travels from the caller, which sets its value, to the function, which can use the value. An output parameter travels from the function, which sets its value, back to the caller, which can use the value. An input-output parameter travels from the caller, which sets its value, to the function, which can use and reset the value, then back to the caller, which can use the value.
parameter-nameThe name of a scalar, array, class, or interface parameter.
ASdata-typeThe data type of a scalar or array parameter. Progress provides these data types: CHARACTER, COM-HANDLE, DATE, DATETIME, DATETIME-TZ, DECIMAL, HANDLE, INTEGER, LOGICAL, LONGCHAR, MEMPTR, RAW, RECID, ROWID, and WIDGET-HANDLE.
EXTENT [expression]Specifies a determinate array parameter (which has a defined number of elements) or an indeterminate array parameter (which has an undefined number of elements). To define a determinate array parameter, specify the EXTENT option with the
expressionargument. This optional argument evaluates to an integer value that represents an extent for the array parameter. To define an indeterminate array parameter, specify the EXTENT option without theexpressionargument. Progress determines the size of indeterminate array parameters at runtime.If you call a function that fixes the number of elements in an indeterminate array, Progress treats the fixed indeterminate array as a determinate array.
If you want to define a parameter that is like an array variable or field, using the LIKE option, but you do not want the parameter to be an array, you can use EXTENT 0 to indicate a non-array field.
If you are using the AS
datatypeoption and you do not use the EXTENT option (or you specifyexpressionas 0), the parameter is not an array parameter.AS [ CLASS ] {type-name}Specifies a class or interface parameter. Progress passes the object reference associated with the class or interface (by value), not the class or interface itself.
type-nameA character string that specifies the type name of a class or interface. Specify a type name using the
package.class-namesyntax as described in the Type-name syntax reference entry in this book.If the specified class or interface type name conflicts with an abbreviation of a built-in Progress data type name, such as INT for INTEGER, you must specify the CLASS keyword.
TABLEtemp-table-nameSpecifies a temporary table parameter.
You can pass a temporary table parameter to both local and remote procedures, as well as methods in a class. Progress passes the parameter by value, by default. That is, the calling routine and the called routine each have their own instance of the temporary table. When you invoke the function, Progress deep-copies the parameter from one routine’s instance to the other routine’s instance. Which table travels depends on whether the parameter is INPUT, OUTPUT, or INPUT-OUTPUT. When you pass a temporary table as an INPUT parameter, Progress overlays the stationary instance with the traveling table, by default. You can also append the traveling table to the end of the stationary instance by specifying the APPEND option. For more information about the APPEND option, see the option description below.
When passing a temporary table parameter to a user-defined function, you can override the default by passing the parameter by reference or by binding (that is, by specifying the parameter in a RUN statement using either the BY-REFERENCE or BIND option). Passing a temporary table parameter by reference or by binding allows the calling routine and the called routine to access the same object instance (instead of deep-copying the parameter).
For more information about passing a temporary table parameter by reference or by binding, see the Parameter passing syntax reference entry. For more information about temporary table parameters, see OpenEdge Development: Progress 4GL Handbook .
TABLE-HANDLEtemp-table-handleSpecifies a temporary table handle parameter.
DATASETdataset-nameSpecifies a ProDataSet object parameter.
You can pass a ProDataSet object parameter to both local and remote procedures, as well as methods in a class. Progress passes the parameter by value, by default. That is, the calling routine and the called routine each have their own instance of the object. When you invoke the function, Progress deep-copies the parameter from one routine’s instance to the other routine’s instance. Which parameter travels depends on whether the parameter is INPUT, OUTPUT, or INPUT-OUTPUT. When you pass a ProDataSet object as an INPUT parameter, Progress overlays the stationary instance with the traveling ProDataSet object, by default. You can also append the traveling ProDataSet object to the end of the stationary instance by specifying the APPEND option. For more information about the APPEND option, see the option description below.
When passing a ProDataSet object parameter to a user-defined function, you can override the default by passing the parameter by reference or by binding (that is, by specifying the parameter in a RUN statement using either the BY-REFERENCE or BIND option). Passing a ProDataSet object parameter by reference or by binding allows the calling routine and the called routine to access the same object instance (instead of deep-copying the parameter).
For more information about passing a ProDataSet object parameter by reference or by binding, see the Parameter passing syntax reference entry. For more information about ProDataSet object parameters, see OpenEdge Development: Progress 4GL Handbook .
DATASET-HANDLEdataset-handleSpecifies a ProDataSet object handle parameter.
APPENDSpecifies whether or not to append the traveling temporary table data to the stationary temporary table instance. To append input parameter data, specify the APPEND option in the FUNCTION statement. To append output parameter data, specify the APPEND option in the RUN statement.
BINDIndicates that a TABLE, TABLE-HANDLE, DATASET, or DATASET-HANDLE parameter binds a reference-only object in one routine to an object instance defined and instantiated in another local routine.
When you define a reference-only object in the calling routine, and you want to bind that object definition to an object instance in the called routine, define the parameter by specifying the BIND option in an INPUT or INPUT-OUTPUT parameter definition. When you define a reference-only object in the called routine, and you want to bind that object definition to an object instance in the calling routine, define the parameter by specifying the BIND option in an OUTPUT parameter definition. In either case, the reference-only object definition remains bound to the object instance until the routine containing the reference-only object definition is deleted or terminates.
Caution: Do not delete the object or routine to which a reference-only object is bound, or you might be left with references to an object that no longer exists.You can bind multiple reference-only object definitions to the same object instance. You can also bind a single reference-only object definition to the same object instance multiple times without generating an error. However, you cannot bind a single reference-only object definition to multiple object instances.
When passing one of these parameters to a remote procedure, Progress ignores the BIND option and deep-copies the parameter based on the specified parameter mode.
For more information about passing these parameters by binding, see the Parameter passing syntax reference entry.
BUFFERbuffer-nameFORdatabase-table-nameSpecifies a database buffer parameter.
Note: A user-defined function that has one or more buffer parameters cannot be invoked remotely. For more information on remote user-defined functions, see OpenEdge Application Server: Developing AppServer Applications .See also
CONSTRUCTOR statement, FUNCTION statement, METHOD statement, SUPER function
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |